/*    */ package junit;
/*    */ 
/*    */ import com.wzh.bean.user.UserInfo;
/*    */ import com.wzh.service.bookinfo.BookInfoService;
/*    */ import com.wzh.service.user.UserService;
/*    */ import com.wzh.utils.MD5;
/*    */ import java.io.PrintStream;
/*    */ import javax.persistence.EntityManagerFactory;
/*    */ import org.hibernate.internal.SessionFactoryImpl;
/*    */ import org.hibernate.jpa.internal.EntityManagerFactoryImpl;
/*    */ import org.junit.BeforeClass;
/*    */ import org.junit.Test;
/*    */ import org.springframework.context.ApplicationContext;
/*    */ import org.springframework.context.support.ClassPathXmlApplicationContext;
/*    */ import org.springframework.orm.jpa.EntityManagerFactoryInfo;
/*    */ 
/*    */ public class BookInfoServiceTest
/*    */ {
/*    */   private static UserService userService;
/*    */   private static BookInfoService bookService;
/*    */   private static ApplicationContext act;
/*    */ 
/*    */   @BeforeClass
/*    */   public static void setUpBeforeClass()
/*    */     throws Exception
/*    */   {
/* 33 */     act = new ClassPathXmlApplicationContext("beans.xml");
/*    */ 
/* 35 */     userService = (UserService)act.getBean("userServiceBean");
/* 36 */     bookService = (BookInfoService)act.getBean("bookInfoServiceBean");
/*    */   }
/*    */ 
/*    */   @Test
/*    */   public void testAddUser()
/*    */   {
/* 42 */     UserInfo user = new UserInfo();
/* 43 */     user.setUsername("admin");
/* 44 */     user.setPassword(MD5.MD5Encode("123456"));
/*    */ 
/* 46 */     userService.save(user);
/*    */   }
/*    */   @Test
/*    */   public void testFindUser() {
/* 50 */     System.out.println(userService.find("admin", "123456").getUsername());
/*    */   }
/*    */ 
/*    */   @Test
/*    */   public void testCache() {
/* 55 */     EntityManagerFactoryInfo entityManagerFactoryInfo = (EntityManagerFactoryInfo)act.getBean("entityManagerFactory");
/* 56 */     EntityManagerFactory emf = entityManagerFactoryInfo.getNativeEntityManagerFactory();
/* 57 */     EntityManagerFactoryImpl emfImp = (EntityManagerFactoryImpl)emf;
/*    */ 
/* 60 */     bookService.getScrollData();
/* 61 */     System.out.println(emfImp.getSessionFactory().getStatistics());
/*    */   }
/*    */ }

/* Location:           C:\work\apache-tomcat-7.0.55\webapps\ROOT\WEB-INF\classes\
 * Qualified Name:     junit.BookInfoServiceTest
 * JD-Core Version:    0.6.1
 */